From 2047f7809acfbfbe8627fff1feca9788f2c27267 Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Fri, 14 Jan 2005 08:35:24 +0000 Subject: [PATCH] bitkeeper revision 1.1159.170.94 (41e7844cyG1BmL1dUF848HyZ7mu87A) Tweaks from Dan Magenheimer. --- xen/common/string.c | 28 ++++++++++++++++++++++++++-- xen/include/public/xen.h | 2 ++ xen/include/xen/irq.h | 1 + xen/include/xen/list.h | 13 +++++++++++++ 4 files changed, 42 insertions(+), 2 deletions(-) diff --git a/xen/common/string.c b/xen/common/string.c index c49d32deb0..1f51b65ecb 100644 --- a/xen/common/string.c +++ b/xen/common/string.c @@ -92,6 +92,32 @@ char * strncpy(char * dest,const char *src,size_t count) } #endif +#ifndef __HAVE_ARCH_STRLCPY +/** + * strlcpy - Copy a %NUL terminated string into a sized buffer + * @dest: Where to copy the string to + * @src: Where to copy the string from + * @size: size of destination buffer + * + * Compatible with *BSD: the result is always a valid + * NUL-terminated string that fits in the buffer (unless, + * of course, the buffer size is zero). It does not pad + * out the result like strncpy() does. + */ +size_t strlcpy(char *dest, const char *src, size_t size) +{ + size_t ret = strlen(src); + + if (size) { + size_t len = (ret >= size) ? size-1 : ret; + memcpy(dest, src, len); + dest[len] = '\0'; + } + return ret; +} +EXPORT_SYMBOL(strlcpy); +#endif + #ifndef __HAVE_ARCH_STRCAT /** * strcat - Append one %NUL-terminated string to another @@ -449,7 +475,6 @@ void * memmove(void * dest,const void *src,size_t count) * @ct: Another area of memory * @count: The size of the area. */ -/* int memcmp(const void * cs,const void * ct,size_t count) { const unsigned char *su1, *su2; @@ -460,7 +485,6 @@ int memcmp(const void * cs,const void * ct,size_t count) break; return res; } -*/ #endif #ifndef __HAVE_ARCH_MEMSCAN diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h index 3f00fe2e06..9817b1a9e8 100644 --- a/xen/include/public/xen.h +++ b/xen/include/public/xen.h @@ -18,6 +18,8 @@ #include "arch-x86_32.h" #elif defined(__x86_64__) #include "arch-x86_64.h" +#elif defined(__ia64__) +#include "arch-ia64.h" #else #error "Unsupported architecture" #endif diff --git a/xen/include/xen/irq.h b/xen/include/xen/irq.h index 793a848f63..42e6d266a4 100644 --- a/xen/include/xen/irq.h +++ b/xen/include/xen/irq.h @@ -21,6 +21,7 @@ struct irqaction #define IRQ_PENDING 4 /* IRQ pending - replay on enable */ #define IRQ_REPLAY 8 /* IRQ has been replayed but not acked yet */ #define IRQ_GUEST 16 /* IRQ is handled by guest OS(es) */ +#define IRQ_PER_CPU 256 /* IRQ is per CPU */ /* * Interrupt controller descriptor. This is all we need diff --git a/xen/include/xen/list.h b/xen/include/xen/list.h index 618f291962..cc38a310cd 100644 --- a/xen/include/xen/list.h +++ b/xen/include/xen/list.h @@ -162,3 +162,16 @@ static __inline__ void list_splice(struct list_head *list, struct list_head *hea pos = n, n = pos->next) #endif + +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + prefetch(pos->member.next); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member), \ + prefetch(pos->member.next)) -- 2.30.2